// 灾害防控子系统接口
import request from '@/utils/sysRequest';

// 查询指定基础工作流状态-泳道视图  工作流版本号   （查询预案详情）
export function findBpmBasicForOtherView(bpm_version) {
	return request({
		url: '/aiplatformauth/findBpmBasicForOtherView',
		method: 'get',
		params: {
			bpm_version: bpm_version,
		},
	});
}
// 查询仅基础工作流所有列表  (根据灾害分类获取推荐预案)
export function findBpmBasicAll(bpm_classification) {
	return request({
		url: '/aiplatformauth/findBpmBasicAll',
		method: 'get',
		params: {
			bpm_classification: bpm_classification,
		},
	});
}
// 查询执行工作流和其所有节点信息 (查询正在执行的流程 弃用)
export function findBpmExecuteInfo() {
	return request({
		url: '/aiplatformauth/findBpmExecuteInfo',
		method: 'get',
		params: {
			bpm_executestatus: '进行中',
		},
	});
}
// 查询仅执行工作流所有列表 (查询最新 预启动/已启动 的流程)
export function findExecuteBpmBasicAll() {
	return request({
		url: '/aiplatformauth/findExecuteBpmBasicAll',
		method: 'get',
		params: {},
	});
}
// 预启动工作流  (编辑预案)
export function preStartBpm(bpm_version) {
	return request({
		url: '/aiplatformauth/preStartBpm',
		method: 'post',
		params: {
			bpm_version: bpm_version,
		},
	});
}
//  删除执行流程及其关联信息  (取消编辑中的预案)
export function delExecuteBpm(bpm_id) {
	return request({
		url: '/aiplatformauth/delExecuteBpm',
		method: 'post',
		params: {
			bpm_id: bpm_id,
		},
	});
}
// 启动工作流  (启动预案)
export function startPreStartBpm(startPreStartBpmDto) {
	return request({
		url: '/aiplatformauth/startPreStartBpm',
		method: 'post',
		data: startPreStartBpmDto,
		headers: {
			'Content-Type': 'application/json;charset=UTF-8',
		},
	});
}
// forceStopBpm 强制结束工作流 (强制结束预案)
export function forceStopBpm(bpm_executeversion, sign) {
	return request({
		url: `/aiplatformauth/forceStopBpm/${bpm_executeversion}/${sign}`,
		method: 'post',
	});
}

// 更新执行工作流节点信息  (编辑任务)
export function editExecuteBpmNodeInfo(bpmNodeInfo) {
	return request({
		url: '/aiplatformauth/editExecuteBpmNodeInfo',
		method: 'post',
		data: bpmNodeInfo,
		headers: {
			'Content-Type': 'application/json;charset=UTF-8',
		},
	});
}

// 更新执行工作流节点信息  (新增任务，新增部门)
export function addExecuteBpmNodeInfo(bpmNodeInfo) {
	return request({
		url: '/aiplatformauth/addExecuteBpmNodeInfo',
		method: 'post',
		data: bpmNodeInfo,
		headers: {
			'Content-Type': 'application/json;charset=UTF-8',
		},
	});
}

// 查询执行工作流和其所有节点信息  预案预启动/启动 之后查看预案详情
export function findOneExecuteBpmInfoForAnQiuEmergency(bpm_executeversion) {
	return request({
		url: '/aiplatformauth/findOneExecuteBpmInfoForAnQiuEmergency',
		method: 'get',
		params: {
			bpm_executeversion: bpm_executeversion,
		},
	});
}

// 删除执行工作流节点信息 删除任务/部门
export function delExecuteBpmNodeInfo(bni_id) {
	return request({
		url: '/aiplatformauth/delExecuteBpmNodeInfo',
		method: 'post',
		params: {
			bni_id: bni_id,
		},
	});
}

// 工作流某节点提交审核（状态变更） 下发、修改任务状态
export function submitBpm(bni_id, status) {
	return request({
		url: '/aiplatformauth/submitBpm',
		method: 'post',
		data: {
			bni_executestatus: status,
			bni_id: bni_id,
		},
		headers: {
			'Content-Type': 'application/json;charset=UTF-8',
		},
	});
}

// 更新灾害点信息,传递 id 指定灾害点  （关联灾害预警 和 流程）
export function updateDisasterPoint(dp_id, bpm_executeversion) {
	return request({
		url: '/aiplatformsmartagriculture1/api/DisasterPointApi/updateDisasterPoint',
		method: 'post',
		data: {
			dp_id: dp_id,
			dp_relationexcuteprocessversion: bpm_executeversion,
		},
		headers: {
			'Content-Type': 'application/json;charset=UTF-8',
		},
	});
}

// 根据过滤条件查询灾害点信息数据  （查询预案关联的预警信息）
export function findDisasterPoint(dp_relationexcuteprocessversion, dp_submittime) {
	return request({
		url: '/aiplatformsmartagriculture1/api/DisasterPointApi/findDisasterPoint',
		method: 'get',
		params: {
			dp_relationexcuteprocessversion: dp_relationexcuteprocessversion,
			dp_submittime: dp_submittime,
		},
	});
}

//  应急资源接口-获取全部应急资源列表
export function getAllEmergency() {
	return request({
		url: '/aiplatformsmartagriculture1/api/emergency/all',
		method: 'get',
	});
}
// 获取应急资源列表以树的形式
export function getResourceTree() {
	return request({
		url: '/aiplatformsmartagriculture1//api/emergency/getResourceTree',
		method: 'get',
	});
}
// 增加研判报告
export function newReports(data) {
	return request({
		url: '/api/digitalEarth/thematicMap/add',
		method: 'post',
		data: data,
	});
}
// 上传专题制图
// export function addScreen(data) {
// 	return request({
// 		url: '/aiplatformsmartagriculture1/api/material/addByFileBase64',
// 		method: 'post',
// 		data: data,
// 		headers: {
// 			'Content-Type': 'multipart/form-data'
// 		}
// 	})
// }
export function addScreen(data) {
	return request({
		url: '/api/material/addByFileBase64',
		method: 'post',
		data: data,
		headers: {
			'Content-Type': 'application/json;charset=UTF-8',
		},
	});
}
// 添加研判报告接口
export function addReport(data) {
	return request({
		url: '/aiplatformsmartagriculture1/api/researchReport/add',
		method: 'post',
		data: data,
		headers: {
			'Content-Type': 'multipart/form-data',
		},
	});
}
// 查询专题制图
export function searchScreen(data) {
	return request({
		url: '/api/material/all',
		method: 'get',
		params: {},
	});
}
// export function searchScreen(data) {
// 	let param = new FormData()
// 	param.append('mlClassification', 1)
// 	return request({
// 		url: '/api/material/getListByType',
// 		method: 'get',
// 		params: { param }
// 	})
// }
// 查询研判报告
export function searchReport(data) {
	return request({
		url: '/aiplatformsmartagriculture1/api/researchReport/all',
		method: 'get',
		params: {
			sort: 'desc',
		},
	});
}
// 易火点
// export function findfire(data) {
// 	return request({
// 		url: '/aiplatformdataview/fire/data/fire',
// 		method: 'get',
// 		params: {
// 			st:'2020-07-27 08:00',
// 			et:"2020-07-28 08:00",
// 			page :2,
// 			pageSize :10
// 		}
// 	})
// }
// 获取火点信息
export function findFireData(param) {
	return request({
		url: '/aiplatformdataview/fire/data/fire',
		method: 'get',
		params: param,
		// params: {st:param.st, et:param.et, page:param.page, pageSize:param.pageSize}
	});
}
